{% extends "@admin/index.twig" %}

{% set title = 'Запитвания' %}

    {% block content %}
        <legend class='col-md-offset-1 col-md-10'>Запитвания</legend>
        <br />
        <br />
        {% if message is defined %}
            <div class="alert {{ message.type }}">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                {{ message.text }}
            </div>
        {% endif %}

        <div class="mails" style="padding-bottom: 20px;">
            <br/>
            {% if mails|length %}
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>№</th>
                            <th>Име</th>
                            <th>Мейл</th>
                            <th>Текст</th>
                            <th>Телефон</th>
                            <th>Ip Адрес</th>
                            <th colspan="2">Действие</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for Mail in mails %}
                            <tr class="{% if Mail.isNew %}new{% endif %}">
                                <td>{{ Mail.id }}</td>
                                <td>{{ Mail.name }}</td>
                                <td>{{ Mail.email }}</td>
                                <td>{{ Mail.text }}</td>
                                <td>{{ Mail.phone }}</td>
                                <td>{{ Mail.ip }}</td>
                                <td class="col-md-1">
                                    <a href="{{ path('admin_mails_details', {'id': Mail.id}) }}" class='btn alert-info'><i class="glyphicon glyphicon-view">&nbsp;</i>Детайли</a>
                                </td>
                                <td class="col-md-1">
                                    <a href="{{ path('admin_mails_delete', {'id': Mail.id}) }}" data-message="Сигурни ли сте че искате да изтриете това съобщение?" class='confirm btn alert-danger'><i class="glyphicon glyphicon-remove">&nbsp;</i>Изтрий</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% else %}
                <br />
                <br />
                <div>
                    Няма запитвания.
                </div>
                <br />
            {% endif %}
        </div>
    {% endblock content %}